/**
 * gome
 * created by 虚拟前端组 on 2015-09-15
 */
var root = window || {};
root.BASE_PATH = "/", root.API_PATH = this.BASE_PATH + "recharge/v2/api/", root.API_PATH2 = this.BASE_PATH + "common/v1/api/", root.API_PATH3 = this.BASE_PATH + "common/v2/api/", root.EMPTY_FN = function() {
}, root.Versions = "1";
var util = {simTitle: function(a, b, c) {
        a.each(function(a, d) {
            var e = $(this), f = '<div class="positiontip-warp" style="position:absolute; display:none; width:280px; padding:20px; margin-bottom:10px; line-height:22px;background:#FFF;box-shadow:0 0 12px rgba(0,0,0,0.2);z-index:101; text-align:left;"></div>';
            0 == $(".positiontip-warp").length && $("body").append(f), e.on("mouseenter", function(a) {
                var d = $(this), e = d.attr("simtitle"), f = d.offset(), g = f.top - b, h = f.left - c;
                $(".positiontip-warp").show().html(e).css({top: g, left: h}), a.stopPropagation()
            }), e.on("mouseleave", function(a) {
                $(".positiontip-warp").hide(), a.stopPropagation()
            })
        })
    }, api: function(a, b) {
        var c = this, d = a.success || root.EMPTY_FN, e = a.error || root.EMPTY_FN, f = a.complete || root.EMPTY_FN, g = a.beforeSend || root.EMPTY_FN, h = (new Date).getTime();
        a.surl ? a.url = a.surl : a.url = root.API_PATH + a.url, a.url.indexOf("?") > -1 ? a.url += "&cachest=" + h : a.url += "?cachest=" + h, a = $.extend({type: "post", async: !0, dataType: "json", contentType: "application/json; charset=utf-8"}, a, {success: function(a, b, c) {
                a.code, a.msg;
                return $(".pond-submit-btn").removeClass("disable"), d.apply(this, arguments)
            }, beforeSend: function() {
                return g.apply(this, arguments)
            }, error: function(a, b) {
                return c.showErrorInfo(a), e.apply(this, arguments)
            }, complete: function(a, b) {
                return f.apply(this, arguments)
            }}), "post" == a.type && a.data && (a.data = JSON.stringify(a.data));
        var i = $.ajax(a);
        return i
    }, showErrorInfo: function(a) {
    }, formatPn: function(a) {
        return a.length >= 7 ? a = a.substring(0, 3) + "-" + a.substring(3, 7) + "-" + a.substring(7, a.length) : a.length >= 3 && (a = a.substring(0, 3) + "-" + a.substring(3, 7)), a
    }, pad: function(a) {
        var b = new Array(2 - ("" + a).length + 1).join(0) + a;
        return b
    }, formatDate: function(a, b) {
        var c = "", d = new Date(a), e = d.getFullYear(), f = this.pad(d.getMonth() + 1), g = this.pad(d.getDate()), h = this.pad(d.getHours()), i = this.pad(d.getMinutes()), j = this.pad(d.getSeconds()), k = b || 1;
        switch (k) {
            case 1:
                c = e + "-" + f + "-" + g + " " + h + ":" + i;
                break;
            case 2:
                c = f + "-" + g + " " + h + ":" + i;
                break;
            case 3:
                c = e + "-" + f + "-" + g;
                break;
            case 4:
                c = h + ":" + i + ":" + j
        }
        return c
    }, setFocus: function(a, b) {
        if (a = a.get(0))
            if ($.browser.msie) {
                var c = a.createTextRange();
                c.move("character", b), c.select()
            } else
                a.setSelectionRange(b, b), a.focus()
    }, getLocationParams: function(a, b) {
        a = a || location.href;
        var c, d = null;
        return-1 !== a.indexOf("?") && (c = a.slice(a.indexOf("?") + 1), c.indexOf("#") == c.length - 1 && (c = c.slice(0, c.length - 1)), b && (c = util.decode(c)), c.length > 0 && (d = {}, c = c.split("/"), $.each(c, function(a, b) {
            var c = b.split("=");
            d[c[0]] = decodeURI(b.substring(b.indexOf("=") + 1, b.length))
        }))), d
    }, layerShow: function(a, b) {
        var c = $.browser.msie, d = c && $.browser.version < 7;
        !$("#Overlay").length > 0 && (d ? ($("html").css({height: "100%"}), $("body").css({height: "100%"}), $("body").append("<div class='overlay' id='Overlay'><iframe  frameborder=0 id='frame1' style='filter:alpha(opacity=10);opacity: 0.6;height:100%;width:100%;'></iframe></div>")) : $("body").append("<div id='Overlay' style='background:#000;cursor: pointer;display: block;filter:alpha(opacity=60);opacity: 0.6;height:100%;width:100%; position: fixed; left: 0;top: 0;z-index:9999998'></div>")), $("#Overlay").show();
        var e = $("#" + a), f = (document.documentElement.clientHeight - e.height()) / 2, g = (document.documentElement.clientWidth - e.width()) / 2;
        d ? (e.css("position", "absolute").show(), e.addClass("chagetop")) : e.css("top", f).css("left", g).css("position", "fixed").css("z-index", "9999999").show()
    }, closeLayer: function(a) {
        $("#" + a).hide(), $("#Overlay").hide()
    }, alert: function(a, b, c, d) {
        var e = this, f = '<div id="alertDialog">                            <i class="close"></i>                            <p class="message-p">                                <i class="warn"></i>                             <span class="message">' + a + '</span> </p>                                             <p class="buttongroup">                              <button class="ok">确定</button>                 <button class="cancel">取消</button>         </p>                                            </div>                                           ';
        e.layerShow(), $("#alertDialog").length < 1 ? $("body").append(f) : $("#alertDialog").show().find(".message").html(a), c && ($("#alertDialog .cancel").show(), d && $("#alertDialog .cancel").html(d)), $("#alertDialog .ok").off("click").on("click", function() {
            $("#alertDialog .cancel").click(), b && b()
        }), $("#alertDialog .cancel, #alertDialog .close").off("click").on("click", function() {
            e.closeLayer("alertDialog")
        })
    }};
$.extend(util, {_keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode: function(a) {
        var b, c, d, e, f, g, h, i = "", j = 0;
        for (a = this._utf8_encode(a); j < a.length; )
            b = a.charCodeAt(j++), c = a.charCodeAt(j++), d = a.charCodeAt(j++), e = b >> 2, f = (3 & b) << 4 | c >> 4, g = (15 & c) << 2 | d >> 6, h = 63 & d, isNaN(c) ? g = h = 64 : isNaN(d) && (h = 64), i = i + util._keyStr.charAt(e) + util._keyStr.charAt(f) + util._keyStr.charAt(g) + util._keyStr.charAt(h);
        return i
    }, decode: function(a) {
        var b, c, d, e, f, g, h, i = "", j = 0;
        for (a = a.replace(/[^A-Za-z0-9\+\/\=]/g, ""); j < a.length; )
            e = util._keyStr.indexOf(a.charAt(j++)), f = util._keyStr.indexOf(a.charAt(j++)), g = util._keyStr.indexOf(a.charAt(j++)), h = util._keyStr.indexOf(a.charAt(j++)), b = e << 2 | f >> 4, c = (15 & f) << 4 | g >> 2, d = (3 & g) << 6 | h, i += String.fromCharCode(b), 64 != g && (i += String.fromCharCode(c)), 64 != h && (i += String.fromCharCode(d));
        return i = this._utf8_decode(i)
    }, _utf8_encode: function(a) {
        a = a.replace(/\r\n/g, "\n");
        for (var b = "", c = 0; c < a.length; c++) {
            var d = a.charCodeAt(c);
            128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(d >> 6 | 192), b += String.fromCharCode(63 & d | 128)) : (b += String.fromCharCode(d >> 12 | 224), b += String.fromCharCode(d >> 6 & 63 | 128), b += String.fromCharCode(63 & d | 128))
        }
        return b
    }, _utf8_decode: function(a) {
        for (var b = "", c = 0, d = c1 = c2 = 0; c < a.length; )
            d = a.charCodeAt(c), 128 > d ? (b += String.fromCharCode(d), c++) : d > 191 && 224 > d ? (c2 = a.charCodeAt(c + 1), b += String.fromCharCode((31 & d) << 6 | 63 & c2), c += 2) : (c2 = a.charCodeAt(c + 1), c3 = a.charCodeAt(c + 2), b += String.fromCharCode((15 & d) << 12 | (63 & c2) << 6 | 63 & c3), c += 3);
        return b
    }}), $.extend(util, {rsaEncrypt: function(a, b, c) {
        var d = new RSAKey, e = "";
        return c && (d.setPublic(a, b), e = d.encrypt(c)), e
    }}), root.util = util;